package com.example.transformer;

import java.util.ArrayList;

public class Skeletal {
	
	public ArrayList<Bone> boneList; 
	public ArrayList<Vector3> pointList;
	public ArrayList<Bone> boneOffset;

	public Skeletal()
	{
		boneList = new ArrayList<Bone>();
		pointList = new ArrayList<Vector3>();
		boneOffset = boneList;
	}
	
	public void addBone(float x, float y, float z, float x1, float y1, float z1)
	{
		Bone bone = new Bone(x,y,z,x1,y1,z1);
		boneList.add(bone);
		Vector3 tmp = new Vector3(x,y,z);
		addPoint(tmp);
		tmp = new Vector3(x1,y1,z1);
		addPoint(tmp);
	}
	
	public Vector3 getPoint(int boneInd, int pos)
	{
		Bone bone = boneList.get(boneInd);
		return bone.p[pos];		
	}
	
	public void addPoint(Vector3 p)
	{
		if(!pointList.contains(p))
			pointList.add(p);
	}	
	
	
	/* ====================== END OF CLASS ======================== */	
	
	/**
	 * Clase que maneja un hueso con dos puntos. 
	 * @author Melinton
	 *
	 */
	public class Bone {		
		public Vector3[] p;
		
		public Bone(float x, float y, float z, float x1, float y1, float z1)
		{
			p = new Vector3[2];
			Vector3 p1 = new Vector3(x,y,z);
			Vector3 p2 = new Vector3(x1,y1,z1);
			setPoints(p1, p2);
		}
		
		public void setPoints(Vector3 p1, Vector3 p2)
		{
			p[0] = p1;
			p[1] = p2;
		}
		
	}

}
